Please write in Java A array palindrome is an array which wh
Please write in Java
A \'array palindrome\' is an array which, when its elements are reversed, remains the same (i.e., the elements of the array are same when scanned forward or backward) Write a recursive, boolean -valued method , isPalindrome, that accepts an integer -valued array , and a pair of integers representing the starting and ending indexes of the portion of the array to be tested for being a palindrome. The function returns whether that portion of the array is a palindrome.
An array is a palindrome if:
Solution
PalindromeArray.java
 public class PalindromeArray {
   public static void main(String[] args) {
        System.out.println(isPalindrome(new int[]{1,2,3,2,1},0, 5));
        System.out.println(isPalindrome(new int[]{1,2,4,3,5},0, 5));
   }
    public static boolean isPalindrome(int a[], int start, int end){
       
        if(a.length == 0 || a.length == 1)
            return true;
        if(start >= end)
    return true;
   if(a[start] != a[end-1])
    return false;
   return isPalindrome(a, start + 1, end -1);
    }
}
Output:
true
 false

